<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<input type="button" name="btn" id="btn" value="点我" />
		<input type="button" name="btn" id="cbtn" value="关闭" />
		
		<script type="text/javascript">
			var newWindow ;
			document.getElementById("btn").onclick = function(){
				var cof = confirm("确定要弹出一个窗口吗？");
				if(cof){
					 newWindow = open("http://www.baidu.com");
				}else{
					alert("byby")
				}
				
			}
			
			document.getElementById("cbtn").onclick = function(){
				var cof = confirm("确定要关闭窗口吗？");
				if(cof){
					 newWindow.close();
				}else{
					alert("byebye")
				}
				
			}
		</script>
	</body>
</html>
